import { Column, Entity } from 'typeorm'
import { SoftCompleteEntity } from '~/common/entity/common.entity'

export enum WorkType {
  Video = 2,
  Audio = 3,
}

export enum WorkStatus {
  Normal = 0, // 普通
  Champion = 1, // 冠军
}

@Entity({ name: 'c_work' })
export class WorkEntity extends SoftCompleteEntity {
  @Column({ name: 'work_id' })
  workId: string

  @Column({ name: 'work_title' })
  workTitle: string

  @Column({ name: 'work_description', nullable: true, type: 'text' })
  workDescription: string

  @Column({ name: 'work_type', default: WorkType.Video })
  workType: WorkType

  @Column({ name: 'file_url' })
  fileUrl: string

  @Column({ name: 'thumbnail_url', nullable: true })
  thumbnailUrl: string

  @Column({ name: 'student_id' })
  studentId: number

  @Column({ name: 'class_id', nullable: true, type: 'varchar', length: 50 })
  classId: string

  @Column({ name: 'teacher_id', nullable: true })
  teacherId: number

  @Column({ name: 'view_count', default: 0 })
  viewCount: number

  @Column({ name: 'like_count', default: 0 })
  likeCount: number

  @Column({ default: WorkStatus.Normal })
  status: WorkStatus
}
